package com.ebupt.migu.music.pubBroadcast.controller;


import com.ebupt.migu.music.common.entity.ResultObject;
import com.ebupt.migu.music.pubBroadcast.entity.createPolicy.CreatePolicyBo;
import com.ebupt.migu.music.pubBroadcast.entity.createPolicy.TagInfoBo;
import com.ebupt.migu.music.pubBroadcast.service.CreatePolicyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 创建策略模块
 */
@RestController
@RequestMapping("/createPolicy")
public class CreatePolicyController {

    @Autowired
    private CreatePolicyService createPolicyService;

    /**
     * 获取1级 2级标签
     * @return
     */
    @GetMapping(value = "/primaryAndSecondTag")
    public ResultObject primaryAndSecondTag() {
        return createPolicyService.primaryAndSecondTag();
    }

    /**
     * 音乐馆、店铺根据父标签ID获取子标签或者根据标签ID 获取标签
     * @return
     */
    @PostMapping(value = "/tagInfo")
    public ResultObject tagInfo(@RequestBody TagInfoBo tagInfoBo) {
        return createPolicyService.tagInfo(tagInfoBo);
    }


    /**
     * 文件上传
     * @param file
     * @return
     */
    @PostMapping(value = "/upload")
    public ResultObject uploadCSVFile(@RequestParam("file") MultipartFile file) {
        return createPolicyService.uploadCSVFile(file);
    }

    /**
     * 策略配置-运营歌单标签 或者 语音播报分类查询
     * @return
     */
    @GetMapping(value = "/policyMusicOrRadio")
    public ResultObject policyMusicOrRadio() {
        return createPolicyService.policyMusicOrRadio();
    }


    /**
     * 创建公播平台策略
     * @param createPolicyBo
     * @return
     */
    @PostMapping(value = "/create")
    public ResultObject createPolicy(@RequestBody CreatePolicyBo createPolicyBo) {
        return createPolicyService.createPolicy(createPolicyBo);
    }
}
